package com.sky.mapper;

import com.sky.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface UserMapper {

    //根据openid查数据库中有没有这个用户
    @Select("select * from user where openid=#{openid}")
    User getByOpenid(String openid);

    //如果是新用户插入用户表，注意Controller层需要返回主键
    void insert(User user);

    //根据userId查找user
    @Select("select * from user where id=#{userId}")
    User getById(Long userId);
}
